package com.ls.system.mapper;



import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ls.system.entity.SysUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ls
 * @since 2025-04-06
 */
public interface SysUserMapper extends BaseMapper<SysUser> {
    @Select("SELECT * FROM sys_user WHERE loginname = #{loginname}")
    SysUser findByLoginname(String loginname);

    @Insert("INSERT INTO sys_user (loginname, password, available) " +
            "VALUES (#{loginname}, #{password}, 1)")
    int insert(SysUser user);

    @Insert("INSERT INTO sys_user " +
            "(loginname, password, name, sex, telephone, email, available, hiredate, salt) " +
            "VALUES " +
            "(#{loginname}, #{password}, #{name}, #{sex}, #{telephone}, #{email}, #{available}, #{hiredate}, #{salt})")
    int insertUser(SysUser user);
}
